<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<script type="text/javascript" src="${ctx}/js/jquery.itextclear.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
    });
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="${ctx}/css/Tree.css"/>
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="${ctx}/lib/datatables/css/vpad.css"/>
<script type="text/javascript" src="${ctx}/lib/datatables/js/jquery.dataTables.js"></script>
<!-- DATATABLES CSS END -->

<h1 class="page-title">工号规则设置</h1>

<div class="container_12 clearfix leading">
    <div class="tabs side grid_8 leading">
        <div class="clear"></div>
        <div class="grid_12">

            <div id="demo" class="clearfix">
                <table class="display" id="example">
                    <thead>
                    <tr>
                        <th>公司英文名称</th>
                        <th>工号数字部分位数</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr class="gradeX">
                        <td>
                            <s:if test="#request.workNo.organization.topOrganization == null">${workNo.organization.employeeNo}</s:if>
                            <s:else>${workNo.organization.topOrganization.employeeNo}</s:else>
                        </td>
                        <td>
                            <p>
                                <select style="opacity: 1;" id="activity_part">
                                    <option value="1">0</option>
                                    <option value="2">00</option>
                                    <option value="3">000</option>
                                    <option value="4">0000</option>
                                    <option value="5">00000</option>
                                    <option value="6">000000</option>
                                    <option value="7">0000000</option>
                                    <option value="8">00000000</option>
                                    <option value="9">000000000</option>
                                    <option value="10">0000000000</option>
                                </select>
                            </p>
                        </td>
                        <td>
                            <button class="button" type="button" onclick="save()">修改</button>
                        </td>
                    </tr>
                    </tbody>
                </table>

                <br/><br/><br/><br/><br/><br/><br/><br/><br/>
                一旦有员工信息录入系统中，工号规则将无法修改
            </div>
            <div class="form-action clearfix"></div>
        </div>
    </div>
</div>

<div class="clear"></div>


<script type="text/javascript" src="${ctx}/js/Tree.js"></script>
<script type="text/javascript">
    $(function(){
        $("#activity_part").val("${workNo.activity}");
    });

    function save(){
        var work_no_activity_part = $("#activity_part").val();
        var url = "/workno/save.xhtml?organizationId=${workNo.organization.id}&workNo.id=${workNo.id}&workNo.activity="+work_no_activity_part;
        $.getJSON(url, function(result) {
            if(result){
                alert("操作成功");
            }
        });
    }
</script>

